-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(clients): make POST body related to the endpoint, assert body in tests #849
Conversation
✅ Deploy Preview for api-clients-automation canceled.
|
✗ The generated branch has been deleted.If the PR has been merged, you can check the generated code on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good ! Hopefully all endpoints accept that !
Doing more tests on the |
9b758b5
to
eca2fc5
Compare
DELETE
requests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for java and php ! But you are still getting undefined for js
Yup I'm importing the echoRequester fixes from the other PR, just making sure it works properly |
81e42dc
to
2903221
Compare
DELETE
requests94464cc
to
bfc99ff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GG !
...oliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/JSONBuilder.java
Outdated
Show resolved
Hide resolved
.../algoliasearch-client-javascript/packages/client-common/src/transporter/createTransporter.ts
Outdated
Show resolved
Hide resolved
@@ -50,7 +50,8 @@ private function normalize($options) | |||
'headers' => [ | |||
'x-algolia-application-id' => $this->config->getAppId(), | |||
'x-algolia-api-key' => $this->config->getAlgoliaApiKey(), | |||
'User-Agent' => $this->config->getAlgoliaAgent() !== null | |||
'User-Agent' => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the php changes can be moved to another PR until @damcou is back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes for the PHP client here still fixes the POST
methods that were not working previously (e.g. browse
). However, I've removed the transporter/CTS changes in the meantime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good !
🧭 What and Why
🎟 JIRA Ticket: https://algolia.atlassian.net/browse/DI-321
The issue was discovered in #823, but I've moved the fix for the clients here.
Changes included:
The goal of this PR is to assert the body of each requests in the CTS even when we don't expect to have one.
On some
POST
requests, the body can be optional (e.g.browse
), but needs to be a valid JSON object, when no body is expected at all (e.g.clearAllSynonyms
), an empty string is considered as valid.In any case, an empty object (Some endpoints do not expect a body at all, so we need to move that logic at the method level since it can't be factorized.'{}'
) is considered as valid.Issue
browse
method with only anindexName
throws an empty body errorclearRules
method with a body throws an unexpected body errorNext
Fix
null
body forGET
andDELETE
methods on the PHP client, once @damcou is back: https://algolia.atlassian.net/browse/APIC-591🧪 Test
deleteApiKey
for theDELETE
method changebrowse
with empty object only for thePOST
method change